home *** CD-ROM | disk | FTP | other *** search
- Path: newsserver.trl.OZ.AU!usenet
- From: t.hand@trl.oz.au (Trevor Hand)
- Newsgroups: comp.lang.c++
- Subject: BC45, using a function in another project.
- Date: 16 Jan 1996 04:36:22 GMT
- Organization: Telstra Research Laboratories
- Message-ID: <4dfa06$eui@newsserver.trl.OZ.AU>
- NNTP-Posting-Host: tmp_ip_159.trl.oz.au
- X-Newsreader: News Xpress Version 1.0 Beta #3
-
- I am building a group of general functions which are
- stored in a file called "MyUtils\GenUtil.cpp". How do I
- declare each function so that they are available to another
- file in another directory, ie. they have global access, so
- they can be used by other projects. eg.
-
- ------------------------------
- \MyUtils\GenUtil.cpp -
- my collection of functions
-
- int MyGeneralVariable;
-
- void MyGeneralFunction(){
- //Does something usefull
- };
- ------------------------------
-
- ------------------------------
- \Programs\MyApp.cpp
- #include "GenUtil.h" //I have set Project/Options to include a
- //path to MyUtils. A node to GenUtil.cpp is added to the IDE file.
- :
- :
- MyGeneralFunction();//Linker says MyGeneralFunction is undefined
- i = MyGeneralVariable;//I also want to use a variable from GenUtil.
- :
- ------------------------------
-
- What do I have to do? Does MyGeneralFunction() have to be extern?
-
- Trevor Hand
- t.hand@trl.oz.au
-